package com.hitfm.iplay.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.AbsSeekBar;

public class RatingBar extends AbsSeekBar{

	public RatingBar(Context context) {
		super(context);
	}

	public RatingBar(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public RatingBar(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	public interface OnRatingBarChangeListener {
		void onRatingChanged(RatingBar verticalRatingBar, float rating, boolean fromUser);
	}

	private OnRatingBarChangeListener mOnRatingBarChangeListener;
	
	public void setOnRatingBarChangeListener(OnRatingBarChangeListener l) {
		mOnRatingBarChangeListener = l;
	}
	
	void onRatingChanged(RatingBar verticalRatingBar,float rating, boolean fromUser) {
		if (mOnRatingBarChangeListener != null) {
			mOnRatingBarChangeListener.onRatingChanged(verticalRatingBar, rating, fromUser);
		}
	}
	
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		return super.onTouchEvent(event);
	}
	
	protected void onDraw(Canvas c) {
		c.rotate(90);
		super.onDraw(c);
	}

}
